<%@ page import="java.util.List" %>
<%@ page import="com.dys.entity.Emp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        table {
            border: 3px solid blue;
            width: 80%;
            margin: 0 auto;
        }

        td, th {
            border: 2px solid green;
        }
    </style>
</head>
<body>
<table cellspacing="0px" cellpadding="0px">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>上级编号</th>
        <th>职务</th>
        <th>入职日期</th>
        <th>薪资</th>
        <th>补助</th>
        <th>部门号</th>
        <th>薪资等级</th>
    </tr>
    <%
        List<Emp> emps = (List<Emp>) request.getAttribute("emps");
        for (Emp emp : emps) {
            // 将Emp对象放到PageContext域中
            pageContext.setAttribute("emp", emp);
    %>
    <tr>
        <td>${emp.empno}
        </td>
        <td>${emp.ename}
        </td>
        <td>${emp.mgr}
        </td>
        <td>${emp.job}
        </td>
        <td>${emp.hiredate}
        </td>
        <td>${emp.sal}
        </td>
        <td>${emp.comm}
        </td>
        <td>${emp.deptno}
        </td>
        <td>
            ${emp.sal le 500?"A":""}
            ${emp.sal gt 500 and emp.sal le 1000?"B":""}
            ${emp.sal gt 1000 and emp.sal le 1500?"C":""}
            ${emp.sal gt 1500 and emp.sal le 2000?"D":""}
            ${emp.sal gt 2000 and emp.sal le 3000?"E":""}
            ${emp.sal gt 3000 and emp.sal le 4000?"F":""}
            ${emp.sal gt 4000?"G":""}
        </td>
    </tr>
    <%
        }
    %>

</table>
</body>
</html>
